package com.bookmanage.utils;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBUitls {
    public static Connection getConn()  {
        try {
            Class.forName("com.mysql.jdbc.Driver");

            String dbUrl = "jdbc:mysql://localhost:3306/normalinfo?useUnicode=true&characterEncoding=UTF-8";
            String dbUsername = "root";
            String dbPassword = "root";
            Connection conn = (Connection) DriverManager.getConnection(dbUrl, dbUsername, dbPassword);
            return conn;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("数据库连接错误 = "+e.getMessage());
        }
    }
}
